from flask import Flask

from libs.init_app import init_app
from libs.init_extensions import init_migrate
from libs.init_logger import init_logger
from libs.init_blueprints import register_blueprints
from apps.models import *


def create_app():
    app = Flask(__name__)

    try:
        from config.local import Config
        app.config.from_object(Config)
    except Exception as exc:
        raise Exception(f'{exc}')

    init_app(app)
    init_migrate(app)
    register_blueprints(app)
    init_logger(app)
    return app
